package com.payment.web.controller.tool;

import com.alibaba.fastjson.JSONObject;
import com.payment.common.utils.StringUtils;
import com.payment.system.domain.PaymentOrder;
import com.payment.system.domain.SystemConfig;
import com.payment.system.service.IMoneyChangeService;
import com.payment.system.util.GuangGuUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;

/**
 * @author fuzhili
 * @Description: 碰一碰
 * @date 2020/1/10 9:18
 */
@Controller
@RequestMapping("/test/pyp")
public class TestPYPController {
    @Autowired
    private IMoneyChangeService moneyChangeService;
    /**
     * 碰一碰分润
     */
    @RequestMapping("/commissions")
    @ResponseBody
    public String commissions() throws Exception {
        PaymentOrder paymentOrder = new PaymentOrder();
        paymentOrder.setId(StringUtils.randomUUID());
        paymentOrder.setOrderType(12);
        paymentOrder.setAmountMoney( BigDecimal.valueOf(1000));
        paymentOrder.setMerchantId("663EB56ABA3D40A5A7783E88B1394250");
        paymentOrder.setProfitMoney(BigDecimal.valueOf(3.38));
        moneyChangeService.commissions(paymentOrder.getId(), paymentOrder.getOrderType(),
                paymentOrder.getAmountMoney(), paymentOrder.getMerchantId(), paymentOrder.getProfitMoney());
        return "碰一碰分润===";
    }


    /**
     * 碰一碰查询省列表
     */
    @RequestMapping("/pypQueryProvince")
    @ResponseBody
    public String order() throws Exception {
        JSONObject jsonObject = GuangGuUtil.pypQueryProvince("3001","1");
        return "碰一碰查询省列表===" + jsonObject.toJSONString();
    }

}
